## Replication file for "The Effect of Associative Racial Cues in Elections"
## Adam Berinsky, Justin de Benedictis-Kessner, Meg Goldberg, and Michele Margolis
## Political Communication

library(tidyverse)
library(foreign)
library(stargazer)

#### Read data: ####
## Mailer ad experiment:
print <- read_csv("print_experiment.csv")

# subsets
print_att <- subset(print, median_scr_b == 2)

print_black <- subset(print, race_black == 1)
print_white <- subset(print, race_white == 1)

print_black_att <- subset(print_black, median_scr_b == 2)
print_white_att <- subset(print_white, median_scr_w == 2)

## Radio Ad Experiment:
radio <- read_csv("radio_experiment.csv")

## subsets:
radio_att <- subset(radio, att==1)

radio_black <- subset(radio, black.resp==1)
radio_white <- subset(radio, white.resp==1)

radio_black_att <- subset(radio, black.resp==1 & att==1)
radio_white_att <- subset(radio, white.resp==1 & att==1)


#### Figure 2 ####
## Treatment effects on race recall, both experiments, black respondents
recall_b_m <- lm(black_recall ~ black + control, data=print_black)
recall_b_r <- lm(race_recall_black_DW ~ (race_treat=="Black Treatment"), data=radio_black)
recall_ba_m <- lm(black_recall ~ black + control, data=print_black_att)
recall_ba_r <- lm(race_recall_black_DW ~ (race_treat=="Black Treatment"), data=radio_black_att)

df <- bind_rows(summary(recall_b_m)$coefficients["black",], 
								summary(recall_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",], 
								summary(recall_ba_m)$coefficients["black",],
								summary(recall_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",])
df$sample <- c("Full\nSample","Full\nSample","Attentive\nSubsample","Attentive\nSubsample")
df$exp <- c("Mailer","Radio","Mailer","Radio")
df <- mutate(df,
						 ci.up = Estimate + qnorm(0.975)*`Std. Error`,
						 ci.lo = Estimate + qnorm(0.025)*`Std. Error`)
		 
coefplot_recall_black <- ggplot(df) + 
	geom_segment(aes(x=ci.lo,xend=ci.up,y=sample, yend=sample,col=sample,lty=sample),lwd=1) + 
	geom_point(aes(x=Estimate,y=sample,col=sample,shape=sample),size=3) + 
	geom_vline(xintercept = 0,lty=2) + 
	facet_wrap(~exp,ncol=2) + 
	theme_bw() + 
	scale_x_continuous("Treatment effect on prop. recalling as black\n(black condition-white condition)",limits=c(-0.2,0.6),breaks=seq(-0.4,0.6,0.2)) + 
	scale_y_discrete("") + 
	scale_color_manual(values = c("Attentive\nSubsample" = "black","Full\nSample" = "darkslategray")) + 
	theme(legend.position = "none")

ggsave(coefplot_recall_black, filename = "figure2.pdf",height = 2,width=7)


#### Figure 3 ####
## treatments effects on all other DVs, both experiments, black respondents
favor_b_m <- lm(cand_favor ~ black + control, data=print_black)
vote_b_m <- lm(cand_vote ~ black + control, data=print_black)
ideo_b_m <- lm(cand_ideo ~ black + control,data=print_black)
rep_b_m <- lm(cand_rep ~ black + control,data=print_black)
iss1_b_m <- lm(cand_aa ~ black + control,data=print_black);summary(iss1_b_m)
iss2_b_m <- lm(cand_defense ~ black + control,data=print_black);summary(iss2_b_m)
iss3_b_m <- lm(cand_gay ~ black + control,data=print_black);summary(iss3_b_m)
iss4_b_m <- lm(cand_services ~ black + control,data=print_black);summary(iss4_b_m)
trait1_b_m <- lm(trait_hardwork ~ black + control,data=print_black);summary(trait1_b_m)
trait2_b_m <- lm(trait_cares ~ black + control,data=print_black);summary(trait2_b_m)
trait3_b_m <- lm(trait_honest ~ black + control,data=print_black);summary(trait3_b_m)
trait4_b_m <- lm(trait_moral ~ black + control,data=print_black);summary(trait4_b_m)
trait5_b_m <- lm(trait_know ~ black + control,data=print_black);summary(trait5_b_m)
trait6_b_m <- lm(trait_leader ~ black + control,data=print_black);summary(trait6_b_m)

favor_ba_m <- lm(cand_favor ~ black + control, data=print_black_att)
vote_ba_m <- lm(cand_vote ~ black + control, data=print_black_att)
ideo_ba_m <- lm(cand_ideo ~ black + control, data=print_black_att)
rep_ba_m <- lm(cand_rep ~ black + control, data=print_black_att)
iss1_ba_m <- lm(cand_aa ~ black + control,data=print_black_att);summary(iss1_ba_m)
iss2_ba_m <- lm(cand_defense ~ black + control,data=print_black_att);summary(iss2_ba_m)
iss3_ba_m <- lm(cand_gay ~ black + control,data=print_black_att);summary(iss3_ba_m)
iss4_ba_m <- lm(cand_services ~ black + control,data=print_black_att);summary(iss4_ba_m)
trait1_ba_m <- lm(trait_hardwork ~ black + control,data=print_black_att);summary(trait1_ba_m)
trait2_ba_m <- lm(trait_cares ~ black + control,data=print_black_att);summary(trait2_ba_m)
trait3_ba_m <- lm(trait_honest ~ black + control,data=print_black_att);summary(trait3_ba_m)
trait4_ba_m <- lm(trait_moral ~ black + control,data=print_black_att);summary(trait4_ba_m)
trait5_ba_m <- lm(trait_know ~ black + control,data=print_black_att);summary(trait5_ba_m)
trait6_ba_m <- lm(trait_leader ~ black + control,data=print_black_att);summary(trait6_ba_m)

favor_b_r <- lm(favorDW ~ (race_treat=="Black Treatment"),data=radio_black)
vote_b_r <- lm(voteDWBA ~ (race_treat=="Black Treatment"),data=radio_black)
ideo_b_r <- lm(ideoDW ~ (race_treat=="Black Treatment"),data=radio_black)
rep_b_r <- lm(repDW ~ (race_treat=="Black Treatment"),data=radio_black)
iss1_b_r <- lm(aaDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(iss1_b_r)
iss2_b_r <- lm(defenseDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(iss2_b_r)
iss3_b_r <- lm(gaymarDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(iss3_b_r)
iss4_b_r <- lm(serviceDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(iss4_b_r)
trait1_b_r <- lm(hardworkDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(trait1_b_r)
trait2_b_r <- lm(caresDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(trait2_b_r)
trait3_b_r <- lm(honestDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(trait3_b_r)
trait4_b_r <- lm(moralDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(trait4_b_r)
trait5_b_r <- lm(knowlDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(trait5_b_r)
trait6_b_r <- lm(leaderDW ~ (race_treat=="Black Treatment"),data=radio_black);summary(trait6_b_r)

favor_ba_r <- lm(favorDW ~ (race_treat=="Black Treatment"),data=radio_black_att)
vote_ba_r <- lm(voteDWBA ~ (race_treat=="Black Treatment"),data=radio_black_att)
ideo_ba_r <- lm(ideoDW ~ (race_treat=="Black Treatment"),data=radio_black_att)
rep_ba_r <- lm(repDW ~ (race_treat=="Black Treatment"),data=radio_black_att)
iss1_ba_r <- lm(aaDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(iss1_ba_r)
iss2_ba_r <- lm(defenseDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(iss2_ba_r)
iss3_ba_r <- lm(gaymarDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(iss3_ba_r)
iss4_ba_r <- lm(serviceDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(iss4_ba_r)
trait1_ba_r <- lm(hardworkDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(trait1_ba_r)
trait2_ba_r <- lm(caresDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(trait2_ba_r)
trait3_ba_r <- lm(honestDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(trait3_ba_r)
trait4_ba_r <- lm(moralDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(trait4_ba_r)
trait5_ba_r <- lm(knowlDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(trait5_ba_r)
trait6_ba_r <- lm(leaderDW ~ (race_treat=="Black Treatment"),data=radio_black_att);summary(trait6_ba_r)

df <- bind_rows(
	summary(vote_b_m)$coefficients["black",],
	summary(favor_b_m)$coefficients["black",],
	summary(rep_b_m)$coefficients["black",],
	summary(ideo_b_m)$coefficients["black",],
	summary(iss1_b_m)$coefficients["black",],
	summary(iss2_b_m)$coefficients["black",],
	summary(iss3_b_m)$coefficients["black",],
	summary(iss4_b_m)$coefficients["black",],
	summary(trait1_b_m)$coefficients["black",],
	summary(trait2_b_m)$coefficients["black",],
	summary(trait3_b_m)$coefficients["black",],
	summary(trait4_b_m)$coefficients["black",],
	summary(trait5_b_m)$coefficients["black",],
	summary(trait6_b_m)$coefficients["black",],
	
	summary(vote_ba_m)$coefficients["black",],
	summary(favor_ba_m)$coefficients["black",],
	summary(rep_ba_m)$coefficients["black",],
	summary(ideo_ba_m)$coefficients["black",],
	summary(iss1_ba_m)$coefficients["black",],
	summary(iss2_ba_m)$coefficients["black",],
	summary(iss3_ba_m)$coefficients["black",],
	summary(iss4_ba_m)$coefficients["black",],
	summary(trait1_ba_m)$coefficients["black",],
	summary(trait2_ba_m)$coefficients["black",],
	summary(trait3_ba_m)$coefficients["black",],
	summary(trait4_ba_m)$coefficients["black",],
	summary(trait5_ba_m)$coefficients["black",],
	summary(trait6_ba_m)$coefficients["black",],
	
	summary(vote_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(favor_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(rep_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(ideo_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss1_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss2_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss3_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss4_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait1_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait2_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait3_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait4_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait5_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait6_b_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	
	summary(vote_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(favor_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(rep_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(ideo_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss1_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss2_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss3_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss4_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait1_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait2_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait3_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait4_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait5_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait6_ba_r)$coefficients["race_treat == \"Black Treatment\"TRUE",]
)
df$sample <- c(rep("Full\nSample",14),rep("Attentive\nSubsample",14),rep("Full\nSample",14),rep("Attentive\nSubsample",14))
df$plotorder <- c(14:1)
df$exp <- c(rep("Mailer",28),rep("Radio",28))
df$dv <- c("Vote for DW", "Favor DW", 
					 "Republican","Conservative","Affirmative Action","Defense","Gay Marriage","Services/Spending",
					 "Hardworking","Cares About\nPeople Like Me","Honest","Moral","Knowledgeable","Leader")
df <- mutate(df,
						 ci.up = Estimate + qnorm(0.975)*`Std. Error`,
						 ci.lo = Estimate + qnorm(0.025)*`Std. Error`)


coefplot_nonrecall_black <- ggplot(df) + 
	geom_errorbar(aes(ymin=ci.lo,ymax=ci.up,x=plotorder,col=sample,lty=sample),
							 position = position_dodge(width=0.5),width=0,lwd=1) + 
	geom_point(aes(y=Estimate,x=plotorder,col=sample,shape=sample,group=sample),
						 position = position_dodge(width=0.5),size=3) + 
	geom_hline(yintercept = 0,lty=2) + 
	geom_vline(xintercept = 12.5,lty=1) + 
	geom_vline(xintercept = 6.5,lty=1) + 
	facet_wrap(~exp,ncol=2) + 
	theme_bw() + 
	scale_y_continuous("Treatment effect\n(black condition-white condition)",breaks=round(seq(-0.3,0.2,0.1),1)) + 
	scale_x_continuous("",breaks=c(14:1),
									 labels=c("Vote for DW", "Favor DW", 
									 				 "Republican","Conservative",
									 				 "Affirmative Action","Defense","Gay Marriage","Services/Spending",
									 				 "Hardworking","Cares About\nPeople Like Me","Honest","Moral","Knowledgeable","Leader")) + 
	coord_flip() +
	scale_color_manual(values = c("Full\nSample" = "darkslategray","Attentive\nSubsample" = "black")) + 
	theme(legend.position = "right",legend.title = element_blank(),legend.key.height = unit(2,units = "lines"),
				plot.margin = unit(c(1, 1, 1, 1.25), "lines"))

pdf("figure3.pdf",height = 7,width=10)
print(coefplot_nonrecall_black)
grid::grid.text("Traits", x = 0.02, y = 0.3, gp = grid::gpar(fontsize = 10, fontface = "italic"),rot=90) 
grid::grid.lines(x = 0.035,y=c(0.125,0.45))
grid::grid.lines(x = c(0.035,0.04),y=0.125)
grid::grid.lines(x = c(0.035,0.04),y=0.45)
grid::grid.text("Political Perceptions", x = 0.02, y = 0.63, gp = grid::gpar(fontsize = 10, fontface = "italic"),rot=90)
grid::grid.lines(x = 0.035,y=c(0.47,0.8))
grid::grid.lines(x = c(0.035,0.04),y=0.47)
grid::grid.lines(x = c(0.035,0.04),y=0.8)
dev.off()



#### Figure 4 ####
## treatment effects on race recall, both experiments, white respondents
recall_w_m <- lm(black_recall ~ black + control, data=print_white)
recall_w_r <- lm(race_recall_black_DW ~ (race_treat=="Black Treatment"), data=radio_white)
recall_wa_m <- lm(black_recall ~ black + control, data=print_white_att)
recall_wa_r <- lm(race_recall_black_DW ~ (race_treat=="Black Treatment"), data=radio_white_att)

df <- bind_rows(summary(recall_w_m)$coefficients["black",], 
								summary(recall_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",], 
								summary(recall_wa_m)$coefficients["black",],
								summary(recall_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",])
df$sample <- c("Full\nSample","Full\nSample","Attentive\nSubsample","Attentive\nSubsample")
df$exp <- c("Mailer","Radio","Mailer","Radio")
df <- mutate(df,
						 ci.up = Estimate + qnorm(0.975)*`Std. Error`,
						 ci.lo = Estimate + qnorm(0.025)*`Std. Error`)


coefplot_recall_white <- ggplot(df) + 
	geom_segment(aes(x=ci.lo,xend=ci.up,y=sample, yend=sample,col=sample,lty=sample),lwd=1) + 
	geom_point(aes(x=Estimate,y=sample,col=sample,shape=sample),size=3) + 
	geom_vline(xintercept = 0,lty=2) + 
	facet_wrap(~exp,ncol=2) + 
	theme_bw() + 
	scale_x_continuous("Treatment effect on prop. recalling as black\n(black condition-white condition)",limits=c(-0.2,0.6),breaks=seq(-0.4,0.6,0.2)) + 
	scale_y_discrete("") + 
	scale_color_manual(values = c("Attentive\nSubsample" = "black","Full\nSample" = "darkslategray")) + 
	theme(legend.position = "none")

ggsave(coefplot_recall_white, filename = "figure4.pdf",height = 2,width=7)




#### Figure 5 ####
## treatments effects on all other DVs, both experiments, white respondents
favor_w_m <- lm(cand_favor ~ black + control, data=print_white)
vote_w_m <- lm(cand_vote ~ black + control, data=print_white)
ideo_w_m <- lm(cand_ideo ~ black + control,data=print_white)
rep_w_m <- lm(cand_rep ~ black + control,data=print_white)
iss1_w_m <- lm(cand_aa ~ black + control,data=print_white);summary(iss1_w_m)
iss2_w_m <- lm(cand_defense ~ black + control,data=print_white);summary(iss2_w_m)
iss3_w_m <- lm(cand_gay ~ black + control,data=print_white);summary(iss3_w_m)
iss4_w_m <- lm(cand_services ~ black + control,data=print_white);summary(iss4_w_m)
trait1_w_m <- lm(trait_hardwork ~ black + control,data=print_white);summary(trait1_w_m)
trait2_w_m <- lm(trait_cares ~ black + control,data=print_white);summary(trait2_w_m)
trait3_w_m <- lm(trait_honest ~ black + control,data=print_white);summary(trait3_w_m)
trait4_w_m <- lm(trait_moral ~ black + control,data=print_white);summary(trait4_w_m)
trait5_w_m <- lm(trait_know ~ black + control,data=print_white);summary(trait5_w_m)
trait6_w_m <- lm(trait_leader ~ black + control,data=print_white);summary(trait6_w_m)

favor_wa_m <- lm(cand_favor ~ black + control, data=print_white_att)
vote_wa_m <- lm(cand_vote ~ black + control, data=print_white_att)
ideo_wa_m <- lm(cand_ideo ~ black + control, data=print_white_att)
rep_wa_m <- lm(cand_rep ~ black + control, data=print_white_att)
iss1_wa_m <- lm(cand_aa ~ black + control,data=print_white_att);summary(iss1_wa_m)
iss2_wa_m <- lm(cand_defense ~ black + control,data=print_white_att);summary(iss2_wa_m)
iss3_wa_m <- lm(cand_gay ~ black + control,data=print_white_att);summary(iss3_wa_m)
iss4_wa_m <- lm(cand_services ~ black + control,data=print_white_att);summary(iss4_wa_m)
trait1_wa_m <- lm(trait_hardwork ~ black + control,data=print_white_att);summary(trait1_wa_m)
trait2_wa_m <- lm(trait_cares ~ black + control,data=print_white_att);summary(trait2_wa_m)
trait3_wa_m <- lm(trait_honest ~ black + control,data=print_white_att);summary(trait3_wa_m)
trait4_wa_m <- lm(trait_moral ~ black + control,data=print_white_att);summary(trait4_wa_m)
trait5_wa_m <- lm(trait_know ~ black + control,data=print_white_att);summary(trait5_wa_m)
trait6_wa_m <- lm(trait_leader ~ black + control,data=print_white_att);summary(trait6_wa_m)

favor_w_r <- lm(favorDW ~ (race_treat=="Black Treatment"),data=radio_white)
vote_w_r <- lm(voteDWBA ~ (race_treat=="Black Treatment"),data=radio_white)
ideo_w_r <- lm(ideoDW ~ (race_treat=="Black Treatment"),data=radio_white)
rep_w_r <- lm(repDW ~ (race_treat=="Black Treatment"),data=radio_white)
iss1_w_r <- lm(aaDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(iss1_w_r)
iss2_w_r <- lm(defenseDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(iss2_w_r)
iss3_w_r <- lm(gaymarDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(iss3_w_r)
iss4_w_r <- lm(serviceDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(iss4_w_r)
trait1_w_r <- lm(hardworkDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(trait1_w_r)
trait2_w_r <- lm(caresDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(trait2_w_r)
trait3_w_r <- lm(honestDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(trait3_w_r)
trait4_w_r <- lm(moralDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(trait4_w_r)
trait5_w_r <- lm(knowlDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(trait5_w_r)
trait6_w_r <- lm(leaderDW ~ (race_treat=="Black Treatment"),data=radio_white);summary(trait6_w_r)

favor_wa_r <- lm(favorDW ~ (race_treat=="Black Treatment"),data=radio_white_att)
vote_wa_r <- lm(voteDWBA ~ (race_treat=="Black Treatment"),data=radio_white_att)
ideo_wa_r <- lm(ideoDW ~ (race_treat=="Black Treatment"),data=radio_white_att)
rep_wa_r <- lm(repDW ~ (race_treat=="Black Treatment"),data=radio_white_att)
iss1_wa_r <- lm(aaDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(iss1_wa_r)
iss2_wa_r <- lm(defenseDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(iss2_wa_r)
iss3_wa_r <- lm(gaymarDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(iss3_wa_r)
iss4_wa_r <- lm(serviceDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(iss4_wa_r)
trait1_wa_r <- lm(hardworkDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(trait1_wa_r)
trait2_wa_r <- lm(caresDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(trait2_wa_r)
trait3_wa_r <- lm(honestDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(trait3_wa_r)
trait4_wa_r <- lm(moralDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(trait4_wa_r)
trait5_wa_r <- lm(knowlDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(trait5_wa_r)
trait6_wa_r <- lm(leaderDW ~ (race_treat=="Black Treatment"),data=radio_white_att);summary(trait6_wa_r)

df <- bind_rows(
	summary(vote_w_m)$coefficients["black",],
	summary(favor_w_m)$coefficients["black",],
	summary(rep_w_m)$coefficients["black",],
	summary(ideo_w_m)$coefficients["black",],
	summary(iss1_w_m)$coefficients["black",],
	summary(iss2_w_m)$coefficients["black",],
	summary(iss3_w_m)$coefficients["black",],
	summary(iss4_w_m)$coefficients["black",],
	summary(trait1_w_m)$coefficients["black",],
	summary(trait2_w_m)$coefficients["black",],
	summary(trait3_w_m)$coefficients["black",],
	summary(trait4_w_m)$coefficients["black",],
	summary(trait5_w_m)$coefficients["black",],
	summary(trait6_w_m)$coefficients["black",],
	
	summary(vote_wa_m)$coefficients["black",],
	summary(favor_wa_m)$coefficients["black",],
	summary(rep_wa_m)$coefficients["black",],
	summary(ideo_wa_m)$coefficients["black",],
	summary(iss1_wa_m)$coefficients["black",],
	summary(iss2_wa_m)$coefficients["black",],
	summary(iss3_wa_m)$coefficients["black",],
	summary(iss4_wa_m)$coefficients["black",],
	summary(trait1_wa_m)$coefficients["black",],
	summary(trait2_wa_m)$coefficients["black",],
	summary(trait3_wa_m)$coefficients["black",],
	summary(trait4_wa_m)$coefficients["black",],
	summary(trait5_wa_m)$coefficients["black",],
	summary(trait6_wa_m)$coefficients["black",],
	
	summary(vote_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(favor_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(rep_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(ideo_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss1_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss2_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss3_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss4_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait1_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait2_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait3_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait4_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait5_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait6_w_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	
	summary(vote_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(favor_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(rep_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(ideo_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss1_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss2_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss3_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(iss4_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait1_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait2_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait3_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait4_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait5_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",],
	summary(trait6_wa_r)$coefficients["race_treat == \"Black Treatment\"TRUE",]
)

df$sample <- c(rep("Full\nSample",14),rep("Attentive\nSubsample",14),rep("Full\nSample",14),rep("Attentive\nSubsample",14))
df$plotorder <- c(14:1)
df$exp <- c(rep("Mailer",28),rep("Radio",28))
df$dv <- c("Vote for DW", "Favor DW", 
					 "Republican","Conservative","Affirmative Action","Defense","Gay Marriage","Services/Spending",
					 "Hardworking","Cares About\nPeople Like Me","Honest","Moral","Knowledgeable","Leader")
df <- mutate(df,
						 ci.up = Estimate + qnorm(0.975)*`Std. Error`,
						 ci.lo = Estimate + qnorm(0.025)*`Std. Error`)


coefplot_nonrecall_white <- ggplot(df) + 
	geom_errorbar(aes(ymin=ci.lo,ymax=ci.up,x=plotorder,col=sample,lty=sample),
								position = position_dodge(width=0.5),width=0,lwd=1) + 
	geom_point(aes(y=Estimate,x=plotorder,col=sample,shape=sample,group=sample),
						 position = position_dodge(width=0.5),size=3) + 
	geom_hline(yintercept = 0,lty=2) + 
	geom_vline(xintercept = 12.5,lty=1) + 
	geom_vline(xintercept = 6.5,lty=1) + 
	facet_wrap(~exp,ncol=2) + 
	theme_bw() + 
	scale_y_continuous("Treatment effect\n(black condition-white condition)",breaks=round(seq(-0.3,0.2,0.05),2)) + 
	scale_x_continuous("",breaks=c(14:1),
										 labels=c("Vote for DW", "Favor DW", 
										 				 "Republican","Conservative",
										 				 "Affirmative Action","Defense","Gay Marriage","Services/Spending",
										 				 "Hardworking","Cares About\nPeople Like Me","Honest","Moral","Knowledgeable","Leader")) + 
	coord_flip() +
	scale_color_manual(values = c("Full\nSample" = "darkslategray","Attentive\nSubsample" = "black")) + 
	theme(legend.position = "right",legend.title = element_blank(),legend.key.height = unit(2,units = "lines"),
				plot.margin = unit(c(1, 1, 1, 1.25), "lines"))

pdf("figure5.pdf",height = 7,width=10)
print(coefplot_nonrecall_white)
grid::grid.text("Traits", x = 0.02, y = 0.3, gp = grid::gpar(fontsize = 10, fontface = "italic"),rot=90) 
grid::grid.lines(x = 0.035,y=c(0.125,0.45))
grid::grid.lines(x = c(0.035,0.04),y=0.125)
grid::grid.lines(x = c(0.035,0.04),y=0.45)
grid::grid.text("Political Perceptions", x = 0.02, y = 0.63, gp = grid::gpar(fontsize = 10, fontface = "italic"),rot=90)
grid::grid.lines(x = 0.035,y=c(0.47,0.8))
grid::grid.lines(x = c(0.035,0.04),y=0.47)
grid::grid.lines(x = c(0.035,0.04),y=0.8)
dev.off()



#### Appendix A ####
## Comparison to ANES Sample
anes <- read.dta("anes_timeseries_2016_Stata12.dta")

## Age:
anes$yob <- anes$V161267c

p1 <- ggplot(filter(print, yob_real>0), aes(yob_real)) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("Mailer Experiment Sample") + 
	xlab("Year of Birth") +
	ylim(0,.035) + 
	theme_bw()

p2 <- ggplot(filter(anes, yob>=0), aes(yob, weight=V160101/sum(V160101))) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("2016 ANES Sample") +
	xlab("Year of Birth") +
	ylim(0,.035) + 
	theme_bw()

p3 <- ggplot(filter(radio,yob_real>0), aes(yob_real)) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("Radio Experiment Sample") +
	xlab("Year of Birth") + 
	ylim(0,.035) + 
	theme_bw()

pdf("figureA1.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()

## Black Respondents
p1 <- ggplot(filter(print_black, yob_real>0), aes(yob_real)) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("Mailer Experiment Sample (Black Respondents)") + 
	xlab("Year of Birth") +
	ylim(0,.035) + 
	theme_bw()

p2 <- ggplot(filter(anes, yob>=0 & V161310b == "1. Selected"), aes(yob, weight=V160101/sum(V160101))) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("2016 ANES Sample (Black Respondents)") +
	xlab("Year of Birth") +
	ylim(0,.035) + 
	theme_bw()

p3 <- ggplot(filter(radio_black,yob_real>0), aes(yob_real)) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("Radio Experiment Sample (Black Respondents)") +
	xlab("Year of Birth") + 
	ylim(0,.035) + 
	theme_bw()

pdf("figureA2.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()

## White Respondents:
p1 <- ggplot(filter(print_white, yob_real>0), aes(yob_real)) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("Mailer Experiment Sample (White Respondents)") + 
	xlab("Year of Birth") +
	ylim(0,.035) + 
	theme_bw()

p2 <- ggplot(filter(anes, yob>=0 & V161310a == "1. Selected"), aes(yob, weight=V160101/sum(V160101))) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("2016 ANES Sample (White Respondents)") +
	xlab("Year of Birth") +
	ylim(0,.035) + 
	theme_bw()

p3 <- ggplot(filter(radio_white,yob_real>0), aes(yob_real)) + 
	geom_density() +
	xlim(1920,1998) +
	ggtitle("Radio Experiment Sample (White Respondents)") +
	xlab("Year of Birth") + 
	ylim(0,.035) + 
	theme_bw()

pdf("figureA3.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()

## gender:
anes$female <- ifelse(anes$V161342 == "2. Female",1,0)

## Full sample:
p1 <- ggplot(print, aes(x=female)) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female")) +
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("Mailer Experiment Sample")

p2 <- ggplot(anes, aes(x=female, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("2016 ANES Sample")


p3 <- ggplot(radio, aes(x=female)) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("Radio Experiment Sample")

pdf("figureA4.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


# Black Rs
p1 <- ggplot(print_black, aes(x=female)) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female")) +
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("Mailer Experiment Sample (Black Respondents)")

p2 <- ggplot(filter(anes,V161310b == "1. Selected"), aes(x=female, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("2016 ANES Sample (Black Respondents)")


p3 <- ggplot(radio_black, aes(x=female)) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("Radio Experiment Sample (Black Respondents)")

pdf("figureA5.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


# Black Rs
p1 <- ggplot(print_white, aes(x=female)) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female")) +
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("Mailer Experiment Sample (White Respondents)")

p2 <- ggplot(filter(anes,V161310a == "1. Selected"), aes(x=female, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female")) +
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("2016 ANES Sample (White Respondents)")


p3 <- ggplot(radio_white, aes(x=female)) +
	geom_histogram(aes(y=..density..),bins=2,colour="black")+
	scale_x_continuous("Gender",breaks=c(0,1),
										 labels=c("Male","Female"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	ggtitle("Radio Experiment Sample (White Respondents)")

pdf("figureA6.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


## Education:
anes <- mutate(anes,
							 educ = recode(V161270,
							 							"5. 9th grade"=1,
							 							"6. 10th grade"=1, 
							 							"7. 11th grade"=1, 
							 							"8. 12th grade no diploma"=1,
							 							"9. High school graduate- high school diploma or equivalent (for example: GED)"=2,
							 							"10. Some college but no degree" = 3,
							 							"11. Associate degree in college - occupational/vocational program"=4,
							 							"12. Associate degree in college -- academic program"=4,
							 							"13. Bachelor's degree (for example: BA, AB, BS)" = 5,
							 							"14. Master's degree (for example: MA, MS, MENG, MED, MSW, MBA)"=6,
							 							"15. Professional school degree (for example: MD, DDS, DVM, LLB, JD)"=6,
							 							"16. Doctorate degree (for example: PHD, EDD)"=6,
							 							.default = NA_real_
							 )
)

p1 <- ggplot(print, aes(x=educ)) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("Mailer Experiment Sample")

p2 <- ggplot(anes, aes(x=educ, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("2016 ANES Sample")


p3 <- ggplot(radio, aes(x=educ)) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("Radio Experiment Sample")

pdf("figureA7.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()

## Black Rs:
p1 <- ggplot(print_black, aes(x=educ)) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("Mailer Experiment Sample (Black Respondents)")

p2 <- ggplot(filter(anes,V161310b == "1. Selected"), aes(x=educ, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("2016 ANES Sample (Black Respondents)")


p3 <- ggplot(radio_black, aes(x=educ)) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("Radio Experiment Sample (Black Respondents)")

pdf("figureA8.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()

## White Rs:
p1 <- ggplot(print_white, aes(x=educ)) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("Mailer Experiment Sample (White Respondents)")

p2 <- ggplot(filter(anes,V161310a == "1. Selected"), aes(x=educ, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("2016 ANES Sample (White Respondents)")


p3 <- ggplot(radio_white, aes(x=educ)) +
	geom_histogram(aes(y=..density..),bins=6,colour="black")+
	scale_x_continuous("Education",breaks=c(1,2,3,4,5,6),
										 labels=c("Some HS", "HS Diploma","Some College","2 yr degree",
										 				 "4 yr degree","Post Grad Degree"))+
	scale_y_continuous("",labels=scales::percent_format()) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1)) + 
	ggtitle("Radio Experiment Sample (White Respondents)")

pdf("figureA9.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


## Income:
anes <- mutate(anes,
							 income = recode(V161361x,
							 								"01. Under $5,000 "=1,
							 								"02. $5,000-$9,999 "=1,
							 								"03. $10,000-$12,499 "=2,
							 								"04. $12,500-$14,999 "=2,
							 								"05. $15,000-$17,499 "=3,
							 								"06. $17,500-$19,999 "=3,
							 								"07. $20,000-$22,499 "=4,
							 								"08. $22,500-$24,999 "=4,
							 								"09. $25,000-$27,499 "=5,
							 								"10. $27,500-$29,999 "=5,
							 								"11. $30,000-$34,999 "=6,
							 								"12. $35,000-$39,999 "=6,
							 								"13. $40,000-$44,999 "=7,
							 								"14. $45,000-$49,999 "=7,
							 								"15. $50,000-$54,999 "=8,
							 								"16. $55,000-$59,999 "=8,
							 								"17. $60,000-$64,999 "=9,
							 								"18. $65,000-$69,999 "=9,
							 								"19. $70,000-$74,999 "=10,
							 								"20. $75,000-$79,999 "=10,
							 								"21. $80,000-$89,999 "=11,
							 								"22. $90,000-$99,999 "=11,
							 								"23. $100,000-$109,999 "=12,
							 								"24. $110,000-$124,999 "=12,
							 								"25. $125,000-$149,999 "=12,
							 								"26. $150,000-$174,999 "=13,
							 								"27. $175,000-$249,999 "=13,
							 								"28. $250,000 or more"=13,
							 								.default = NA_real_)
)

print$income <- ifelse(print$income==15, NA, print$income)
print$income <- ifelse(print$income==13,12, print$income)
print$income <- ifelse(print$income==14,13, print$income)
radio$income <- ifelse(radio$income==13,12, radio$income)
radio$income <- ifelse(radio$income==14,13, radio$income)


p1 <- ggplot(print, aes(x=income)) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("Mailer Experiment Sample") + 
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))

p2 <- ggplot(anes, aes(x=income, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("2016 ANES Sample") + 
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))


p3 <- ggplot(radio, aes(x=income)) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("Radio Experiment Sample")  +
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))

pdf("figureA10.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


## Black Rs:
p1 <- ggplot(print_black, aes(x=income)) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("Mailer Experiment Sample (Black Respondents)") + 
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))

p2 <- ggplot(filter(anes,V161310b == "1. Selected"), aes(x=income, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("2016 ANES Sample (Black Respondents)") + 
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))


p3 <- ggplot(radio_black, aes(x=income)) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("Radio Experiment Sample (Black Respondents)")  +
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))

pdf("figureA11.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


## White Rs:
p1 <- ggplot(print_white, aes(x=income)) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("Mailer Experiment Sample (White Respondents)") + 
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))

p2 <- ggplot(filter(anes,V161310a == "1. Selected"), aes(x=income, weight=V160101/sum(V160101))) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("2016 ANES Sample (White Respondents)") + 
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))


p3 <- ggplot(radio_white, aes(x=income)) +
	geom_histogram(aes(y=..density..),bins=13,colour="black")+
	scale_x_continuous("Income",breaks=c(1,2,3,4,5,6,7,8,9,10,11,12,13),
										 labels=c("<10k", "10-15k", "15-20k", "20-25k", "25-30k", 
										 				 "30-40k","40-50k", "50-60k", "60-70k", "70-80k", "80-100k", "100-150k",">150k"))+
	ggtitle("Radio Experiment Sample (White Respondents)")  +
	scale_y_continuous("",labels=scales::percent_format(),limits=c(0,.17)) + 
	theme_bw() + 
	theme(axis.text.x = element_text(angle=45,hjust=1))

pdf("figureA12.pdf",width = 14,height=7)
gridExtra::grid.arrange(p1,
												p2,
												p3,ncol=3)
dev.off()


#### Appendix F ####
recall_radio_all <- lm(black_recall ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(recall_radio_all)
recall_print_all <- lm(black_recall ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(recall_print_all)
recall_radio_att <- lm(black_recall ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(recall_radio_all)
recall_print_att <- lm(black_recall ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(recall_print_all)
# Support:
favor_radio_all <- lm(favorDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
												black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											data=radio);summary(favor_radio_all)
favor_print_all <- lm(cand_favor ~ factor(treat,levels=c("white","black","control")) +
												race_black * factor(treat,levels=c("white","black","control")) ,
											data=print);summary(favor_print_all)
favor_radio_att <- lm(favorDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
												black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											data=radio_att);summary(favor_radio_all)
favor_print_att <- lm(cand_favor ~ factor(treat,levels=c("white","black","control")) +
												race_black * factor(treat,levels=c("white","black","control")) ,
											data=print_att);summary(favor_print_all)

vote_radio_all <- lm(voteDWBA ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
										 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
										 data=radio);summary(vote_radio_all)
vote_print_all <- lm(cand_vote ~ factor(treat,levels=c("white","black","control")) +
										 	race_black * factor(treat,levels=c("white","black","control")) ,
										 data=print);summary(vote_print_all)
vote_radio_att <- lm(voteDWBA ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
										 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
										 data=radio_att);summary(vote_radio_att)
vote_print_att <- lm(cand_vote ~ factor(treat,levels=c("white","black","control")) +
										 	race_black * factor(treat,levels=c("white","black","control")) ,
										 data=print_att);summary(vote_print_att)

# Political perceptions:
ideo_radio_all <- lm(ideoDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
										 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
										 data=radio);summary(ideo_radio_all)
ideo_print_all <- lm(cand_ideo ~ factor(treat,levels=c("white","black","control")) +
										 	race_black * factor(treat,levels=c("white","black","control")) ,
										 data=print);summary(ideo_print_all)
ideo_radio_att <- lm(ideoDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
										 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
										 data=radio_att);summary(ideo_radio_att)
ideo_print_att <- lm(cand_ideo ~ factor(treat,levels=c("white","black","control")) +
										 	race_black * factor(treat,levels=c("white","black","control")) ,
										 data=print_att);summary(ideo_print_att)

rep_radio_all <- lm(repDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
										data=radio);summary(vote_radio_all)
rep_print_all <- lm(cand_rep ~ factor(treat,levels=c("white","black","control")) +
											race_black * factor(treat,levels=c("white","black","control")) ,
										data=print);summary(vote_print_all)
rep_radio_att <- lm(repDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
										data=radio_att);summary(vote_radio_all)
rep_print_att <- lm(cand_rep ~ factor(treat,levels=c("white","black","control")) +
											race_black * factor(treat,levels=c("white","black","control")) ,
										data=print_att);summary(vote_print_all)

# Issue positions:
issue1_radio_all <- lm(aaDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(issue1_radio_all)
issue1_radio_att <- lm(aaDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(issue1_radio_att)
issue2_radio_all <- lm(defenseDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(issue2_radio_all)
issue2_radio_att <- lm(defenseDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(issue2_radio_att)
issue3_radio_all <- lm(gaymarDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(issue3_radio_all)
issue3_radio_att <- lm(gaymarDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(issue3_radio_att)
issue4_radio_all <- lm(serviceDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(issue4_radio_all)
issue4_radio_att <- lm(serviceDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(issue4_radio_att)


issue1_print_all <- lm(cand_aa ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(issue1_print_all )
issue1_print_att <- lm(cand_aa ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(issue1_print_att )
issue2_print_all <- lm(cand_defense ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(issue2_print_all)
issue2_print_att <- lm(cand_defense ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(issue2_print_att)
issue3_print_all <- lm(cand_gay ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(issue3_print_all)
issue3_print_att <- lm(cand_gay ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(issue3_print_att)
issue4_print_all <- lm(cand_services ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(issue4_print_all)
issue4_print_att <- lm(cand_services ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(issue4_print_att)

# Character traits:
trait1_radio_all <- lm(hardworkDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(trait1_radio_all)
trait1_radio_att <- lm(hardworkDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(trait1_radio_att)
trait2_radio_all <- lm(caresDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(trait2_radio_all)
trait2_radio_att <- lm(caresDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(trait2_radio_att)
trait3_radio_all <- lm(honestDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(trait3_radio_all)
trait3_radio_att <- lm(honestDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(trait3_radio_att)
trait4_radio_all <- lm(moralDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(trait4_radio_all)
trait4_radio_att <- lm(moralDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(trait4_radio_att)
trait5_radio_all <- lm(knowlDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(trait5_radio_all)
trait5_radio_att <- lm(knowlDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(trait5_radio_att)
trait6_radio_all <- lm(leaderDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio);summary(trait6_radio_all)
trait6_radio_att <- lm(leaderDW ~ factor(race_treat,levels=c("White Treatment","Black Treatment")) + 
											 	black.resp * factor(race_treat,levels=c("White Treatment","Black Treatment")) ,
											 data=radio_att);summary(trait6_radio_att)

trait1_print_all <- lm(trait_hardwork ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(trait1_print_all )
trait1_print_att <- lm(trait_hardwork ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(trait1_print_att )
trait2_print_all <- lm(trait_cares ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(trait2_print_all)
trait2_print_att <- lm(trait_cares ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(trait2_print_att)
trait3_print_all <- lm(trait_honest ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(trait3_print_all)
trait3_print_att <- lm(trait_honest ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(trait3_print_att)
trait4_print_all <- lm(trait_moral ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(trait4_print_all)
trait4_print_att <- lm(trait_moral ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(trait4_print_att)
trait5_print_all <- lm(trait_know ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(trait5_print_all)
trait5_print_att <- lm(trait_know ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(trait5_print_att)
trait6_print_all <- lm(trait_leader ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print);summary(trait6_print_all)
trait6_print_att <- lm(trait_leader ~ factor(treat,levels=c("white","black","control")) +
											 	race_black * factor(treat,levels=c("white","black","control")) ,
											 data=print_att);summary(trait6_print_att)



## Tables 1-3 (Radio experiment, all Rs)
stargazer(recall_radio_all, favor_radio_all, vote_radio_all, ideo_radio_all, rep_radio_all,
					title=c("Radio Experiment, All Respondents"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"))

stargazer(issue1_radio_all, issue2_radio_all, issue3_radio_all, issue4_radio_all, 
					title=c("Radio Experiment, All Respondents on Issue DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Aff Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"))


stargazer(trait1_radio_all, trait2_radio_all, trait3_radio_all, trait4_radio_all, trait5_radio_all, trait6_radio_all, 
					title=c("Radio Experiment, All Respondents on Trait DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"))


## Tables 4-6 (Radio experiment, attentive Rs)
stargazer(recall_radio_att, favor_radio_att, vote_radio_att, ideo_radio_att, rep_radio_att,
					title=c("Radio Experiment, Attentive Respondents"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"))

stargazer(issue1_radio_att, issue2_radio_att, issue3_radio_att, issue4_radio_att, 
					title=c("Radio Experiment, Attentive Respondents on Issue DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Aff Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"))

stargazer(trait1_radio_att, trait2_radio_att, trait3_radio_att, trait4_radio_att, trait5_radio_att, trait6_radio_att, 
					title=c("Radio Experiment, Attentive Respondents on Trait DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"))

## Mailer experiment:
stargazer(recall_print_all, favor_print_all, vote_print_all, ideo_print_all, rep_print_all,
					title=c("Mailer Experiment, All Respondents"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"))

stargazer(issue1_print_all, issue2_print_all, issue3_print_all, issue4_print_all, 
					title=c("Mailer Experiment, All Respondents on Issue DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Aff Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"))


stargazer(trait1_print_all, trait2_print_all, trait3_print_all, trait4_print_all, trait5_print_all, trait6_print_all, 
					title=c("Mailer Experiment, All Respondents on Trait DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"))


stargazer(recall_print_att, favor_print_att, vote_print_att, ideo_print_att, rep_print_att,
					title=c("Mailer Experiment, Attentive Respondents"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"))

stargazer(issue1_print_att, issue2_print_att, issue3_print_att, issue4_print_att, 
					title=c("Mailer Experiment, Attentive Respondents on Issue DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Aff Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"))

stargazer(trait1_print_att, trait2_print_att, trait3_print_att, trait4_print_att, trait5_print_att, trait6_print_att, 
					title=c("Mailer Experiment, Attentive Respondents on Trait DV's"),
					covariate.labels=c("Black Treatment","Black Respondent","Black Treat x Black Resp","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"))


## Subsample effects by respondent race:
## Black Respondents
stargazer(recall_b_m, favor_b_m, vote_b_m, 
					ideo_b_m, rep_b_m,
					title=c("Mailer Experiment, Black Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(recall_ba_m, favor_ba_m, vote_ba_m, 
					ideo_ba_m, rep_ba_m,
					title=c("Mailer Experiment, Attentive Black Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_b_m, iss2_b_m, iss3_b_m, iss4_b_m, 
					title=c("Mailer Experiment, Black Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_ba_m, iss2_ba_m, iss3_ba_m, iss4_ba_m, 
					title=c("Mailer Experiment, Attentive Black Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")


stargazer(trait1_b_m, trait2_b_m, trait3_b_m, trait4_b_m, trait5_b_m, trait6_b_m, 
					title=c("Mailer Experiment, Black Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

stargazer(trait1_ba_m, trait2_ba_m, trait3_ba_m, trait4_ba_m, trait5_ba_m, trait6_ba_m, 
					title=c("Mailer Experiment, Attentive Black Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

## Radio:
stargazer(recall_b_r, favor_b_r, vote_b_r, 
					ideo_b_r, rep_b_r,
					title=c("Radio Experiment, Black Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(recall_ba_r, favor_ba_r, vote_ba_r, 
					ideo_ba_r, rep_ba_r,
					title=c("Radio Experiment, Attentive Black Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_b_r, iss2_b_r, iss3_b_r, iss4_b_r, 
					title=c("Radio Experiment, Black Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_ba_r, iss2_ba_r, iss3_ba_r, iss4_ba_r, 
					title=c("Radio Experiment, Attentive Black Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")


stargazer(trait1_b_r, trait2_b_r, trait3_b_r, trait4_b_r, trait5_b_r, trait6_b_r, 
					title=c("Radio Experiment, Black Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

stargazer(trait1_ba_r, trait2_ba_r, trait3_ba_r, trait4_ba_r, trait5_ba_r, trait6_ba_r, 
					title=c("Radio Experiment, Attentive Black Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

## White Respondents
stargazer(recall_w_m, favor_w_m, vote_w_m, 
					ideo_w_m, rep_w_m,
					title=c("Mailer Experiment, White Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(recall_wa_m, favor_wa_m, vote_wa_m, 
					ideo_wa_m, rep_wa_m,
					title=c("Mailer Experiment, Attentive White Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_w_m, iss2_w_m, iss3_w_m, iss4_w_m, 
					title=c("Mailer Experiment, White Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_wa_m, iss2_wa_m, iss3_wa_m, iss4_wa_m, 
					title=c("Mailer Experiment, Attentive White Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")


stargazer(trait1_w_m, trait2_w_m, trait3_w_m, trait4_w_m, trait5_w_m, trait6_w_m, 
					title=c("Mailer Experiment, White Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

stargazer(trait1_wa_m, trait2_wa_m, trait3_wa_m, trait4_wa_m, trait5_wa_m, trait6_wa_m, 
					title=c("Mailer Experiment, Attentive White Respondents"),
					covariate.labels=c("Black Treatment","Control","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

## Radio:
stargazer(recall_w_r, favor_w_r, vote_w_r, 
					ideo_w_r, rep_w_r,
					title=c("Radio Experiment, White Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(recall_wa_r, favor_wa_r, vote_wa_r, 
					ideo_wa_r, rep_wa_r,
					title=c("Radio Experiment, Attentive White Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Race Recall","Favorability","Vote", "Ideology","Republican"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_w_r, iss2_w_r, iss3_w_r, iss4_w_r, 
					title=c("Radio Experiment, White Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")

stargazer(iss1_wa_r, iss2_wa_r, iss3_wa_r, iss4_wa_r, 
					title=c("Radio Experiment, Attentive White Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Aff. Action","Defense","Gay Marriage","Services"),
					keep.stat=c("n"),type = "text")


stargazer(trait1_w_r, trait2_w_r, trait3_w_r, trait4_w_r, trait5_w_r, trait6_w_r, 
					title=c("Radio Experiment, White Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")

stargazer(trait1_wa_r, trait2_wa_r, trait3_wa_r, trait4_wa_r, trait5_wa_r, trait6_wa_r, 
					title=c("Radio Experiment, Attentive White Respondents"),
					covariate.labels=c("Black Treatment","Constant"),
					dep.var.labels=c("Hardworking","Cares","Honest","Moral","Knowledgeable","Good Leader"),
					keep.stat=c("n"),type = "text")


#### Appendix G ####
## Table G-1: black respondents, DV = vote for DW, treatment interacted with covariates
fit_vote_print_both <- lm(cand_vote ~ (treat=="black")*female + 
														(treat=="black")*educ + 
														(treat=="black")*income + 
														(treat=="black")*linkedfate + 
														(treat=="black")*(pid==1) + 
														(treat=="black")*(ideo==1), 
													data = filter(print_black, treat %in% c("black","white")))

fit_vote_radio_both <- lm(voteDWBA ~ (treat=="black")*female + 
														(treat=="black")*educ + 
														(treat=="black")*income + 
														(treat=="black")*linkedfate + 
														(treat=="black")*(pid==1) + 
														(treat=="black")*(ideo==1), 
													data = radio_black)

stargazer(fit_vote_print_both,fit_vote_radio_both,
					title=c("Vote for Dave Wilson, Black Respondents"),
					covariate.labels=c("Black Treatment","Female","Education","Income","Linked Fate", "Republican","Conservative",
														 "Black Treatment x Female","Black Treatment x Education","Black Treatment x Income","Black Treatment x Linked Fate", "Black Treatment x Republican","Black Treatment x Conservative"),
					dep.var.caption = "",
					dep.var.labels=c("Mailer Experiment","Radio Experiment"),
					keep.stat=c("n"),type = "text")

## Table G-2: black respondents, DV = favor DW, treatment interacted with covariates
fit_favor_print_both <- lm(cand_favor ~ (treat=="black")*female + 
													 	(treat=="black")*educ + 
													 	(treat=="black")*income + 
													 	(treat=="black")*linkedfate + 
													 	(treat=="black")*(pid==1) + 
													 	(treat=="black")*(ideo==1), 
													 data = filter(print_black, treat %in% c("black","white")))

fit_favor_radio_both <- lm(favorDW ~ (treat=="black")*female + 
													 	(treat=="black")*educ + 
													 	(treat=="black")*income + 
													 	(treat=="black")*linkedfate + 
													 	(treat=="black")*(pid==1) + 
													 	(treat=="black")*(ideo==1), 
													 data = radio_black)

stargazer(fit_favor_print_both,fit_favor_radio_both,
					title=c("Favor Dave Wilson, Black Respondents"),
					covariate.labels=c("Black Treatment","Female","Education","Income","Linked Fate", "Republican","Conservative",
														 "Black Treatment x Female","Black Treatment x Education","Black Treatment x Income","Black Treatment x Linked Fate", "Black Treatment x Republican","Black Treatment x Conservative"),
					dep.var.caption = "",
					dep.var.labels=c("Mailer Experiment","Radio Experiment"),
					keep.stat=c("n"),type = "text")


## Table G-3: white respondents, DV = vote for DW, treatment interacted with covariates
fit_vote_print_white <- lm(cand_vote ~ (treat=="black")*female + 
														(treat=="black")*educ + 
														(treat=="black")*income + 
														(treat=="black")*(pid==1) + 
														(treat=="black")*(ideo==1), 
													data = filter(print_white, treat %in% c("black","white")))

fit_vote_radio_white <- lm(voteDWBA ~ (treat=="black")*female + 
														(treat=="black")*educ + 
														(treat=="black")*income + 
														(treat=="black")*(pid==1) + 
														(treat=="black")*(ideo==1), 
													data = radio_white)

stargazer(fit_vote_print_white,fit_vote_radio_white,
					title=c("Vote for Dave Wilson, White Respondents"),
					covariate.labels=c("Black Treatment","Female","Education","Income", "Republican","Conservative",
														 "Black Treatment x Female","Black Treatment x Education","Black Treatment x Income","Black Treatment x Republican","Black Treatment x Conservative"),
					dep.var.caption = "",
					dep.var.labels=c("Mailer Experiment","Radio Experiment"),
					keep.stat=c("n"),type = "text")

## Table G-4: white respondents, DV = favor DW, treatment interacted with covariates
fit_favor_print_white <- lm(cand_favor ~ (treat=="black")*female + 
													 	(treat=="black")*educ + 
													 	(treat=="black")*income + 
													 	(treat=="black")*(pid==1) + 
													 	(treat=="black")*(ideo==1), 
													 data = filter(print_white, treat %in% c("black","white")))

fit_favor_radio_white <- lm(favorDW ~ (treat=="black")*female + 
													 	(treat=="black")*educ + 
													 	(treat=="black")*income + 
													 	(treat=="black")*(pid==1) + 
													 	(treat=="black")*(ideo==1), 
													 data = radio_white)

stargazer(fit_favor_print_white,fit_favor_radio_white,
					title=c("Favor Dave Wilson, White Respondents"),
					covariate.labels=c("Black Treatment","Female","Education","Income", "Republican","Conservative",
														 "Black Treatment x Female","Black Treatment x Education","Black Treatment x Income","Black Treatment x Republican","Black Treatment x Conservative"),
					dep.var.caption = "",
					dep.var.labels=c("Mailer Experiment","Radio Experiment"),
					keep.stat=c("n"),type = "text")
